home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / AVERAGE.BAS < prev    next >
BASIC Source File  |  1989-08-31  |  591b  |  27 lines

  1. ' AVERAGE.BAS
  2. ' This program prints the average of three numbers.
  3.  
  4. DECLARE FUNCTION Average! (int1%, int2%, int3%)   ' declare function
  5.  
  6. CLS
  7.  
  8. PRINT "Enter three integers to be averaged together."
  9. PRINT
  10. INPUT "    First integer:  ", first%
  11. INPUT "    Second integer:  ", second%
  12. INPUT "    Third integer:  ", third%
  13.  
  14. PRINT
  15. PRINT "The average is"; Average!(first%, second%, third%)
  16.  
  17. END
  18.  
  19. FUNCTION Average! (int1%, int2%, int3%)
  20.  
  21. sum% = int1% + int2% + int3%    ' sum of arguments
  22.  
  23. Average! = sum% / 3             ' return value is average of arguments
  24.  
  25. END FUNCTION
  26.  
  27.